<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
  
<script type="text/javascript">
	$(document).ready(function(){
		$("#gnameCheckBtn").click(function()
				{
					if($("#gname1").val()=="")
					{
					alert("GroupName 을 입력하십시오");
					return false;
					}
						$.ajax({
							type : "post",
							url : "${initParam.root}/checkGroupByName.do",
							data:"gname="+$("#gname1").val(),
							datatype:"json",
							success:function(data){
								if(data==true)
									{
									alert("사용가능한 그룹명 입니다");
									gnameflag=true;
									}
								else
									{
									alert("사용 불가능한 그룹명 입니다");
									gnameflag=false;
									}			
							}
						});
				});
		$("#backBtn").click(function(){
			history.go(-1);
		});
		var gnameflag=false;
		$("#createF").submit(function(){
			if(gnameflag==false)
			{
			alert("GroupName 중복을 확인 하세요");
			return false;
			}
			
			});
		
	});
			
	
</script>

<h2>
<a href="${initParam.root}/member/mypageMyInfo.do">Mypage</a>
<a href="${initParam.root}/member/mypageMyGroup.do">내 그룹</a>
<a href="${initParam.root}/member/mypageMyPoint.do?id=${sessionScope.mvo.id }">내 포인트</a>
<a href="${initParam.root}/member/mypageUpdateView.do">회원정보수정</a>
<a href="${initParam.root}/member/mypageDeleteView.do">회원탈퇴</a>
</h2>

<br>
<h1>Create Group</h1>
<form id="createF" action="${initParam.root}/member/createGroup.do" method="post">
<br> GroupName <br>
<input type="text" id="gname1" name="gname" style="width: 250px;"> &nbsp; <input type="button" id="gnameCheckBtn" value="중복확인"> <Br><br>
GroupContent <br>
<textarea cols="50" rows="200" id="gcontent1" name="gcontent" style="margin: 4px 0px 0px; width: 250px; height: 200px; resize:none"></textarea><br><br>
<input type="submit" value="Create">&nbsp;&nbsp;&nbsp;
<input id="backBtn" type="button" value="Cancel">

</form>
